<?php
class Mission_logModel extends Model {
	//列表
	public function _list($view,$map,$sort='sort',$pagesize=20){
		//计算总页数
		$count=$this->where($map)->count();
		//实例化分页类
		import ( 'ORG.Util.Page' );
		$p=new Page($count,$pagesize);
		$list = $this->where($map)->order($sort)->limit($p->firstRow.',
'.$p->listRows)->select();


        foreach($list as $k => $v){
			$list[$k]['progress'] = M('Schedule') -> where(array('mission_id' => $v['id'])) -> order('datatime desc') -> select();
		}

        $pages=$p->show();
		$view->assign('list',$list);
		$view->assign('pages',$pages);
	}
	
	public function _insert(){
		if(IS_POST){
			$result=$this->add();
			
			
			if(!$result){return false;}
		}else{
			return false;	
		}
	}
}
